import time
def compute_runtime(func):
    def wrapper():
        start = time.time()
        func()
        end = time.time()
        print('%s执行了%f秒' % (func.__name__,end - start))
    return wrapper

@compute_runtime
def run():
    l = [x**2 for x in range(10000)]

run()